using System.Windows.Forms;

namespace BLGenerator.BusinessLogic.ProjectSettings
{
    public class StringProjectSetting : ProjectSetting
    {
        readonly private string _name;

        public StringProjectSetting(string name)
        {
            _name = name;
        }

        public override string Name { get { return _name; } }
        public override object DefaultValue { get { return string.Empty; } }

        public override Control GetControl()
        {
            TextBox tbValue = new TextBox();
            tbValue.Dock = DockStyle.Fill;
            return tbValue;
        }

        public override object GetSetting(Control control)
        {
            TextBox tbValue = control as TextBox;
            return tbValue.Text;
        }

        public override void FillControl(Control control, object value)
        {
            TextBox tbValue = control as TextBox;
            tbValue.Text = value as string;
        }

        public static object GetValueFromString(string str)
        {
            return str;
        }
    }
}